package com.molichuxing.gateway.property;

/**
 * @Author: renzhengyu
 * @Description: 订单统计类型枚举
 * @Date: Created in 14:42 2019/10/16
 * @Modified By:
 **/
public enum OrderStatisticsTypeEnum {

    /**
     * 订阅
     */
    SUBSCRIBE(1, "订阅里程"),
    /**
     * 专属
     */
    EXCLUSIVEL(2, "专属里程");




    int value;
    String name;

    OrderStatisticsTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        OrderStatisticsTypeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static OrderStatisticsTypeEnum getEnum(int value) {
        for (OrderStatisticsTypeEnum enumerate : OrderStatisticsTypeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }
}
